package com.itheima.d3_inner_class3;

/*
    1 匿名内部类在开发中的使用场景
        通常作为一个参数传输给方法。

 */
public class Test2 {
    public static void main(String[] args) {
        MaHu maHu = new MaHu();
        maHu.swim();
        Swimming dog = new Swimming() {
            @Override
            public void swim() {
                System.out.println("狗刨");
            }
        };
        swimmGam(dog);

    }

    public static void swimmGam(Swimming sw) {
        System.out.println("开始");
        sw.swim();
        System.out.println("结束");
    }


}

interface Swimming {
    public void swim();
}

class MaHu implements Swimming {
    @Override
    public void swim() {
        System.out.println("马户游泳");
    }
}